<?php

	require_once(realpath(dirname(__FILE__)) . "/../../classes/Contenu.class.php");
	require_once(realpath(dirname(__FILE__)) . "/../../classes/Contenudesc.class.php");
	
	/* Substitutions de type contenu */
		
	function substitcontenu($texte){
		global $motcle, $id_contenu;

		$tcontenu = new Contenu();
		$tcontenudesc = new Contenudesc();

		if($id_contenu){
			$tcontenu->charger($id_contenu);
			$tcontenudesc->charger($tcontenu->id, $_SESSION['navig']->lang);
		}

		$texte = str_replace("#CONTENU_ID", "$id_contenu", $texte);
		$texte = str_replace("#CONTENU_MOTCLE", "$motcle", $texte);
		$texte = str_replace("#CONTENU_NOM", $tcontenudesc->titre, $texte);
		$texte = str_replace("#CONTENU_CHAPO", $tcontenudesc->chapo, $texte);
		$texte = str_replace("#CONTENU_DESCRIPTION", $tcontenudesc->description, $texte);
		$texte = str_replace("#CONTENU_POSTSCRIPTUM", $tcontenudesc->postscriptum, $texte);

		return $texte;
	
	}
?>